package twu.shuhbam.library;

import org.junit.Test;

import twu.shubham.library.Library;

import static org.junit.Assert.assertEquals;


public class LibraryTests {

    Library book = new Library(2, "");
    Library book1 = new Library(2,"b");
    Library book2 = new Library(0,"c")  ;

    Library movieName = new Library("Sholay",1975,"R.Sippy",7);
    Library movieName1 = new Library("",1975,"R.Sippy",7);
    @Test
    public void withoutBookNameBookWillNotBePrinted() throws Exception {


        assertEquals(0, book.bookPrint(1));
    }

    @Test
    public void withBookNameBookWillBePrinted() throws Exception {


        assertEquals(1, book1.bookPrint(1));
    }

    @Test
    public void withoutMovieNameMovieWillNotBePrinted() throws Exception {


        assertEquals(0, movieName1.moviePrint(1));
    }

    @Test
    public void withMovieNameMovieWillBePrinted() throws Exception {


        assertEquals(1, movieName.moviePrint(1));
    }

    @Test
    public void withoutBookNameBookWillNotBeIssued() throws Exception {


        assertEquals(0, book.reserveBook(1));
    }

    @Test
    public void forCurrentAmountGreaterThanZeroAndWithBookNameBookWillBeIssued() throws Exception {


        assertEquals(1, book1.reserveBook(1));
    }



    @Test
    public void forCurrentAmountEqualsToZeroBookWillNotBeIssued() throws Exception {


        assertEquals(0, book2.reserveBook(1));
    }

    @Test
    public void forCurrentAmountEqualsToActualAmountBookWillNotBeReturned() throws Exception {


        assertEquals(0, book1.returnBook());
    }

    @Test
    public void forCurrentAmountLessThanActualAmountBookWillBeReturned() throws Exception {


        book1.reserveBook(1);
        assertEquals(1, book1.returnBook());
    }
}
